Skip to content

Add xla random generator. #9539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 16, 2025
Merged

Add xla random generator. #9539

merged 3 commits into from
Aug 16, 2025

Conversation

iwknow
Copy link
Contributor

@iwknow iwknow commented Aug 5, 2025

This is the very first PR for #9159. It purely add the generator without any utilization of it. #9159 (comment) comment outlines the steps for entire change.

@iwknow
Copy link
Contributor Author

iwknow commented Aug 5, 2025

@qihqi please review

@iwknow
Copy link
Contributor Author

iwknow commented Aug 7, 2025

a kindly ping @qihqi

@qihqi qihqi self-requested a review August 12, 2025 20:14
@qihqi
Copy link
Collaborator

qihqi commented Aug 12, 2025

Just to understand: so the GeneratorImpl doesn't actually implement the RNG algorithm only manages the state?

@iwknow
Copy link
Contributor Author

iwknow commented Aug 12, 2025

Just to understand: so the GeneratorImpl doesn't actually implement the RNG algorithm only manages the state?

that is correct. it is exactly what https://github.com/pytorch/pytorch/blob/main/aten/src/ATen/cuda/CUDAGeneratorImpl.h does. the idea is that the generator manages the state and different RNG algorithm generates the random numbers based on the state obtained from the generator.

@iwknow
Copy link
Contributor Author

iwknow commented Aug 12, 2025

@qihqi is there anyway to auto-format the cpp code? i know we use yapf for python files in this project.

@iwknow
Copy link
Contributor Author

iwknow commented Aug 12, 2025

@qihqi is there anyway to auto-format the cpp code? i know we use yapf for python files in this project.

nvm, i found the linter uses clang-format-16. i will update the contribution instruction for cpp formatting later. a more important question that needs your attention is #9159 (comment). but if you don't have a strong opinion on it, i will do on my discretion.

@iwknow
Copy link
Contributor Author

iwknow commented Aug 13, 2025

it seems that the failed tests are not related to this change. i've formatted the files.

I don't have the permission to run the tests, please trigger them for me. also, merge if it LGTY. thanks! @qihqi

@qihqi qihqi merged commit a1c6ee9 into pytorch:master Aug 16, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants